/*
 * This file (RxShape.java) is protected by the GNU GPL licence (v2). 
 * Please read the license.txt attached for further informations. 
 * 
 */

package alkwarel.objects;

/**
 * 
 * Roxame shape drawing class.
 * 
 * @author Xavier Gouchet
 * 
 */
public abstract class RxShape extends AkShape {

	/** current position of the brush */
	protected int xp;

	/** current position of the brush */
	protected int yp;

	/**
	 * @param id
	 * @param name
	 */
	public RxShape(int id, String name) {
		super(id, name,null);
	}

	/**
	 * @see alkwarel.objects.AkShape#Draw(alkwarel.objects.AkArtspace)
	 */
	protected abstract boolean Draw(AkArtspace a);

	/**
	 * Move the brush to the selected position
	 * 
	 * @param x
	 * @param y
	 */
	protected final void MoveTo(int x, int y) {
		this.xp = x;
		this.yp = y;
	}

	/**
	 * Trace a "line" from current position to given position.
	 * 
	 * @param a 
	 * @param x
	 * @param y
	 */
	protected final void LineTo(AkArtspace a, int x, int y) {
		if ((x == this.xp) && (this.yp == y))
			return;

		a.DrawStroke(this.xp, this.yp, x, y);
		this.xp = x;
		this.yp = y;
	}
}
